<?php 
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.html.pagination');

$option = JRequest::getCmd('option');

JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');

$history = JRequest::getVar('history');
$app = JFactory::getApplication();
$pageNav = $app->getUserState($option . '.pageNav');
$app->setUserState($option . '.pageNav', null);
$link = JRoute::_('index.php?option=' . $option . '&view=prepaid&layout=edit&id=' . $this->item->id);
?>

<script type="text/javascript">
	window.addEvent('domready', function(){
		$('#jform_amount').keydown(function(event)
		{
			handleDigit(event);
		});
	});
</script>

<form action="<?php echo $link; ?>" method="post" name="adminForm"
	id="prepaid-admin-form" class="form-validate">
	<input type="hidden" name="option" value="<?php echo $option; ?>" /> <input
		type="hidden" name="task" value="" /> <input type="hidden" name="id"
		value="<?php echo $this->item->id; ?>" />
	<?php echo JHtml::_('form.token'); ?>

	<fieldset class="adminform">
		<legend>
			<?php echo JText::_( 'DETAILS' ); ?>
		</legend>
		<ul class="adminformlist">
			<?php foreach ($this->form->getFieldset() as $field)
			{
				?>
			<li><?php echo $field->label; ?> <?php echo $field->input; ?></li>
			<?php
			}
			?>
		</ul>

	</fieldset>

	<div id='editcell'>
		<br> <br>
		<h2 align="center">
			<?php echo JText::_('COM_SHIPNHANH_SHIPNHANH_PREPAID_HISTORY'); ?>
		</h2>
		<br>
		<table class='adminlist'>
			<thead>
				<th>Date</th>
				<th>Comment</th>
				<th>New value</th>
			</thead>
			<tfoot>
				<td colspan="3"><?php

				if ($pageNav != null)
				{
					echo $pageNav->getListFooter();
				}
				?>
				</td>
			</tfoot>
			<?php
			if (!empty($items))
			{
				$k = 0;
				foreach ($history as $item)
				{?>
					<tr class="row<?=$k?>">
						<td><?php echo $item->date; ?></td>
						<td><?php echo $item->comment; ?></td>
						<td><?php echo $item->amount; ?></td>
					</tr>
		
					<?php
					$k = 1 - $k;
				}
			}
			?>
		</table>
	</div>

</form>
